const CompressionWebpackPlugin = require('compression-webpack-plugin')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: '/screen',
  devServer: {
    port: 8998,
    proxy: {
      '/image': {
        target: 'http://10.0.0.58:8888',
        ws: false,
        changeOrigin: true
      },
      '/model': {
        target: 'http://10.0.0.58:8888',
        ws: false,
        changeOrigin: true
      },
      '/': {
        target: 'https://dcs.jscjly.com',
        ws: false,
        changeOrigin: true
      }
    }
  },
  chainWebpack: config => {
    config.plugin('html').tap(args => {
      args[0].scriptLoading = 'blocking'
      return args
    })
  },
  configureWebpack: (config) => {
    console.log(config)
    if (process.env.NODE_ENV === 'production') {
      config.plugins && config.plugins.push(new CompressionWebpackPlugin())
    }
  }
})
